from random import random


class MCPClient:
    def __init__(self,model = "qwen-plus",max_tokens=512,temperature=0.7):
        self.model = model
        self.max_tokens = max_tokens
        self.temperature = temperature
        self.request_id = random.randint(1,10000000)

    def build_request(self,slots,tools=None,options=None):
        """
        构造mcp格式请求
        :param slots: Slot对象列表
        :param tools: 可选，工具调用列表
        :param options: 可选，全局参数设置
        :return: JSON格式请求字典
        """
        slots_list = [slot.to_dict() for slot in slots]
        request_messag = [

        ]

    def call_model(self):
        prompt = ""

    def compose_prompt(self,slot_list):
        """
        根据slot列表构造最总发送个模型的prompt文本
        :param slot_list:
        :return:
        """
        prompt_parts =[]
        for slot in slot_list:
            role = slot.get("role","")
            name = slot.get("name","")
            content = slot.get("content","")

        prompt = '\n'.join(prompt_parts)
        return prompt
